package com.home766.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import net.biz.entity.BaseEntity;
import net.biz.entity.Brand;
import net.biz.entity.Specification;
import net.biz.entity.SpecificationValue;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 方案产品-entity
 */
@Entity
@Table(name="766_scheme_product")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "766_scheme_product_sequence")
public class SchemeProduct extends BaseEntity {
	
	private static final long serialVersionUID = 8837738931254536951L;
	
	/**产品编码*/
	private String sn ;
	/**产品名称*/
	private String name;
	private Long nameId;
	/**品牌*/
	private Brand brand;
	/**规格*/
	private Specification specification;
	/**规格值*/
	private SpecificationValue specificationValue;
	/**方案价格*/
	private BigDecimal price ;
	/**方案类型(暖气，空调，净水之一)*/
	private Long type  ;
	/**创建人*/
	private String createPerson ;
	/**展示图片*/
	private String image;
	/**是否已逻辑删除*/
	private Boolean isDelete = false;
	/**分类*/
	private Dictionary category;
	private Long categoryId;
	/**是否特惠*/
	private Boolean isTehui = false;
	private Boolean isReward=false;
	/**系数*/
	private Double coefficient;
	/**区分类型：有系数的，没有系数的，自选的*/
	private Integer distType;
	
	/**方案*/
	private List<Scheme> schemes = new ArrayList<Scheme>();

	//热值
	private Integer heatValue;

	//排序
	private Integer sortWeight;

	public void setHeatValue(Integer heatValue) {
		this.heatValue = heatValue;
	}

	public void setSortWeight(Integer sortWeight) {
		this.sortWeight = sortWeight;
	}

	@JsonProperty
    @Column(columnDefinition = "INT default 0")
	public Integer getHeatValue() {
		return heatValue;
	}

	@JsonProperty
    @Column(columnDefinition = "INT default 0")
    @OrderBy("order desc ")
	public Integer getSortWeight() {
		return sortWeight;
	}

	@JsonProperty
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	
	@JsonProperty
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@JsonProperty
	@ManyToOne(fetch = FetchType.LAZY)
	public Brand getBrand() {
		return brand;
	}
	public void setBrand(Brand brand) {
		this.brand = brand;
	}
	
	@JsonProperty
	@ManyToOne(fetch = FetchType.LAZY)
	public Specification getSpecification() {
		return specification;
	}
	public void setSpecification(Specification specification) {
		this.specification = specification;
	}
	
	@JsonProperty
	@ManyToOne(fetch = FetchType.LAZY)
	public SpecificationValue getSpecificationValue() {
		return specificationValue;
	}
	public void setSpecificationValue(SpecificationValue specificationValue) {
		this.specificationValue = specificationValue;
	}
	
	@JsonProperty
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	@JsonProperty
	public Long getType() {
		return type;
	}
	public void setType(Long type) {
		this.type = type;
	}
	
	public String getCreatePerson() {
		return createPerson;
	}
	public void setCreatePerson(String createPerson) {
		this.createPerson = createPerson;
	}
	
	@ManyToMany(fetch = FetchType.LAZY)
	public List<Scheme> getSchemes() {
		return schemes;
	}
	public void setSchemes(List<Scheme> schemes) {
		this.schemes = schemes;
	}
	
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	public Boolean getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(Boolean isDelete) {
		this.isDelete = isDelete;
	}
	@JsonProperty
	@ManyToOne(fetch = FetchType.LAZY)
	public Dictionary getCategory() {
		return category;
	}
	public void setCategory(Dictionary category) {
		this.category = category;
	}
	@JsonProperty
	public Long getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}
	@JsonProperty
	public Long getNameId() {
		return nameId;
	}
	public void setNameId(Long nameId) {
		this.nameId = nameId;
	}
	
	@JsonProperty
	public Boolean getIsTehui() {
		return isTehui;
	}
	public void setIsTehui(Boolean isTehui) {
		this.isTehui = isTehui;
	}
	public Double getCoefficient() {
		return coefficient;
	}
	public void setCoefficient(Double coefficient) {
		this.coefficient = coefficient;
	}
	public Integer getDistType() {
		return distType;
	}
	public void setDistType(Integer distType) {
		this.distType = distType;
	}
	@JsonProperty
	public Boolean getIsReward() {
		return isReward;
	}
	public void setIsReward(Boolean isReward) {
		this.isReward = isReward;
	}
	
}
